package org.lex.game.sudoku.view;

import javax.swing.JFrame;

import org.apache.log4j.Logger;
import org.jdesktop.application.ApplicationActionMap;
import org.jdesktop.application.ApplicationContext;
import org.lex.game.sudoku.Prefs;
import org.lex.game.sudoku.SudokuApplication;

public abstract class AbstractController<T> {
	private final SudokuApplication application;
	protected final Logger log = Logger.getLogger(getClass());
	private final T view;

	protected AbstractController(SudokuApplication application, T view) {
		this.application = application;
		this.view = view;
	}

	public SudokuApplication getApplication() {
		return application;
	}

	public ApplicationContext getContext() {
		return this.getApplication().getContext();
	}

	public Prefs getPrefs() {
		return this.getApplication().getPrefs();
	}

	public T getView() {
		return view;
	}

	protected JFrame getMainFrame() {
		return this.getApplication().getMainFrame();
	}

	protected ApplicationActionMap getActionMap() {
		return this.getApplication().getContext().getActionMap();
	}
}
